package com.edu.control;

import com.edu.javaBean.MedicalRecord;
import com.edu.service.MedicalRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class MedicalRecordController {
    @Autowired
    private MedicalRecordService mrService;
    @RequestMapping("/getRecord")
    public Map<String,Object> getRecord(@RequestBody Map<String,Object> map){
        return  mrService.getRecors(map);
    }
    @RequestMapping("/saveRecord")
    public Map<String,Object> saveRecord(MedicalRecord mrd){
        Map<String,Object> map=new HashMap<>();
        int i=mrService.saveRecord(mrd);
        if(i>0){
            map.put("type","succes");
            map.put("msg","操作成功");
        }else{
            map.put("type","reeor");
            map.put("msg","操作失败");
        }
        return map;
    }
}
